<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #msg{
            width: 200px;
            height: 100px;
            border: 1px solid #000;
        }
    </style>
</head>
<body>
    <textarea name="" id="text" cols="30" rows="3"></textarea>
    <input type="button" value="敏感词过滤" id="btn1">
    <div id="msg"></div>

    <script>
        //第一题
        var str1 = ["hello","你好","hi"]
        var btn1 = document.getElementById("btn1")
        var text = document.getElementById("text")
        var msg = document.getElementById('msg')
        btn1.onclick = function(){
            var val = text.value
            for(var i=0;i<val.length;i++){
                for(var j=0;j<str1.length;j++){
                    val = val.replace(str1[i],"***")
                }
            }
            msg.innerHTML = val
        }
    </script>
    
</body>
</html>